function Tiktok() {
  const perfRecord = []
  const _tiktok = (action,id,needPrint)=>{
    const time = new Date().time
    const cost = time - window.performance.domLoading
    const key = `${action}_${id}`
    perfRecord.push({ key, time, cost })
    if (needPrint) {
      printPerfInfo()
    }
  }
  function printPerfInfo() {
    // 延迟3秒，以打印更多、更全面的性能数据
    setTimeout(() => {
      let msg = '=======【页面加载性能报告】=======\n'
      perfRecord.forEach((item) => {
        const { key, cost } = item
        msg += `${cost}ms...${key}\n`
      })
      msg += '==============================='
      console.log(msg)
    }, 3000)
  }
  return _tiktok
}
export default  Tiktok()